'use strict';  

module.exports = {  
  up: async (queryInterface, Sequelize) => {  
    await queryInterface.createTable('quotes', {  
      id: {  
        type: Sequelize.INTEGER,  
        autoIncrement: true,  
        primaryKey: true  
      },  
      project_id: {  
        type: Sequelize.INTEGER,  
        allowNull: false,  
        references: {  
          model: 'projects',  
          key: 'id'  
        },  
        onUpdate: 'CASCADE',  
        onDelete: 'CASCADE' // 或者根据需要选择删除策略  
      },  
      item_description: {  
        type: Sequelize.STRING(255),  
        allowNull: false  
      },  
      amount: {  
        type: Sequelize.DECIMAL(10, 2),  
        allowNull: false  
      },  
      created_at: {  
        type: Sequelize.DATE,  
        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')  
      },  
      updated_at: {  
        type: Sequelize.DATE,  
        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP')  
      }  
    });  
  },  

  down: async (queryInterface, Sequelize) => {  
    await queryInterface.dropTable('quotes');  
  }  
};  